package com.tanhua.dubbo.api;

import com.tanhua.domain.db.UserInfo;
import com.tanhua.dubbo.mapper.UserInfoMapper;
import org.apache.dubbo.config.annotation.Service;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

@Service
public class UserInfoApiImpl implements UserInfoApi {

    @Autowired
    private UserInfoMapper userInfoMapper;

    /**
     * 保存用户信息
     *
     * @param userInfo
     */
    @Override
    public void add(UserInfo userInfo) {
        userInfoMapper.insert(userInfo);
    }

    /**
     * 更新用户信息
     *
     * @param pojo
     */
    @Override
    public void update(UserInfo pojo) {
        userInfoMapper.updateById(pojo);
    }

    /**
     * 通过id查询用户信息
     *
     * @param userId
     * @return
     */
    @Override
    public UserInfo findById(Long userId) {
        return userInfoMapper.selectById(userId);
    }

    /**
     * 通过ids批量查询用户信息
     *
     * @param userIds
     * @return
     */
    @Override
    public List<UserInfo> findByBatchId(List<Long> userIds) {
        return userInfoMapper.selectBatchIds(userIds);
    }
}
